#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from store.mdb_store import TableStore


class SycmWordStore(TableStore):
    def __init__(self, config):
        self.table = config.get('table', 'sycm_word_info')
        self.table_config = {
            'mdb': config['mdb'],
            'table': self.table,
            'column_dic': {
                'snatch_day': "int(11) NOT NULL COMMENT '采集日期YYYYMMDD'",
                'searchword': "varchar(100) NOT NULL COMMENT '搜索关键词'",
                'keyword': "varchar(100) NOT NULL COMMENT '关键词'",
                'clickHits': "int(11) NOT NULL DEFAULT '0' COMMENT '点击人气'",
                'clickHot': "int(11) NOT NULL DEFAULT '0' COMMENT '点击热度'",
                'clickRate': "decimal(30,15) NOT NULL DEFAULT '0' COMMENT '点击率'",
                'spvRatio': "decimal(30,15) NOT NULL DEFAULT '0' COMMENT '每访问者销售额'",
                'tmClickRatio': "decimal(30,15) NOT NULL DEFAULT '0' COMMENT '商城点击占比'",
                'payConvRate': "decimal(30,15) NOT NULL DEFAULT '0' COMMENT '支付转化率'",
                'sePvIndex': "int(11) NOT NULL DEFAULT '0' COMMENT '搜索热度'",
                'onlineGoodsCnt': "int(11) NOT NULL DEFAULT '0' COMMENT '在线商品数'",
                'seIpvUvHits': "int(11) NOT NULL DEFAULT '0' COMMENT '搜索人气'",
                'tradeIndex': "int(11) NOT NULL DEFAULT '0' COMMENT '交易指数'",
                'p4pAmt': "decimal(30,15) NOT NULL DEFAULT '0' COMMENT '直通车参考价'",
            },
            'uniq_idx_fields': ['snatch_day', 'searchword', 'keyword'],
            'idx_dic': {
                '{0}_search_idx'.format(self.table): ['searchword', 'keyword']
            }
        }
        super(SycmWordStore, self).__init__(self.table_config)
